<template>
  <transition
    name="fade"
    enter-active-class="fadeInDown"
    leave-active-class="fadeOutUp"
  >
    <div id="changeport" v-show="changeportShow" :changeportShow="changeportShow">
      <div class="order-1">
        <div class="text">订单号：{{item.ordernumber}}</div>

      </div>
      <div class="order-1">
        <div class="text">充电桩：{{item.parkId}}</div>

      </div>
      <div class="order-1">
        <div class="text">端口号: {{item.portName}}</div>
      </div>
      <div class="order-1">
        <div class="text">端口号: </div>
        <input type="text" name v-model="formDataPort.portCode" placeholder="充电桩端口号" class="my-input" />
      </div>
      <div class="order-1">
        <div class="text">充电桩编号: </div>
        <input type="text" name v-model="formDataPort.parkId" placeholder="充电桩编号" class="my-input" />
      </div>

      <mu-button class="btn" @click="changeportShow = false">取消</mu-button>
      <mu-button class="btn" @click="confimchangeportHandler">确定</mu-button>
    </div>
  </transition>
</template>

<script>
  import { Toast } from "vant";
  import "vant/lib/toast/style/index";
  export default {
    data() {
      return {
        changeportShow:false,
        item: {
          ordernumber: "",
          parkId: "",
          portCode: "",
        },
        formDataPort:{
          orderId:'',
          parkId: "",
          portCode: "",
        }
      };
    },
    methods: {
      Showchangeportdiv(item) {
        this.changeportShow = true;
        this.item={};
        this.item = item;
        this.formDataPort={};
        this.formDataPort.orderId = item.id;
      },
      confimchangeportHandler(){
        if(this.formDataPort.portCode==''){
          Toast('请输入充电桩端口号');
          return;
        }
        if(this.formDataPort.parkId==''){
          Toast('请输入充电桩编号');
          return;
        }

        this.$api.changePort(this.formDataPort).then(res=>{
          console.log(res);
          debugger
          if (res.data.message.code != 0) {
            Toast(res.data.message.message);
          } else {
            Toast('操作成功');
            this.changeportShow = false;
          }
        })

      }
    }
  };
</script>

<style>
</style>
